package com.autonavi.yunda.yunji.common.exception;

import lombok.Getter;

/**
 * @author cswang
 * @date 2021/7/28 2:18 下午
 */
public enum AmapExceptionCode {
    //通用异常
    COMMON_RESOURCE_NOT_FOUNT(404, "resource not found"),
    COMMON_SERVER_SUCCESS(100000, "请求成功"),
    COMMON_SERVER_ERROR(100001, "系统异常"),
    COMMON_ILLEGAL_PARAM(100002, "参数异常"),
    COMMON_NULL_POINT(100003, "空指针错误"),
    COMMON_HTTP_ERROR(100004, "HTTP请求异常"),
    COMMON_SERVER_WARN(100005, "警告异常", ExceptionLevel.WARN),
    COMMON_THIRD_PARTY_TIMEOUT(100006, "第三方服务请求超时"),
    COMMON_SECURITY_ERROR(100007, "安全错误"),
    COMMON_REQUEST_ERROR(100008, "请求异常"),
    NO_PERMISSION_ERROR(100009, "无权限"),
    COMMON_OSS_ERROR(100010, "OSS服务异常"),
    DATA_NOT_EXIST(100011, "数据不存在"),
    FALCON_GET_ERROR(100012, "获取falcon数据异常"),

    //执行链路相关异常
    EXECUTION_LINK_EXECUTE_ERROR(200001, "执行链路异常"),
    SCRIPT_RESOLVE_ERROR(200002, "脚本解析异常"),

    ;
    @Getter
    private final int code;
    @Getter
    private final String text;
    @Getter
    private final ExceptionLevel level;


    AmapExceptionCode(int code, String text) {
        this.code = code;
        this.text = text;
        this.level = ExceptionLevel.ERROR;
    }

    AmapExceptionCode(int code, String text, ExceptionLevel level) {
        this.code = code;
        this.text = text;
        this.level = level;
    }
}
